package cn.wsn2018.tools.model;

import java.util.HashMap;

/**
 * 类名称:MyReportContext
 * 类描述:TODO
 * 创建人:nzx
 * 创建时间:2019/8/10 16:06
 */

public class MyReportContext {
    private static MyReportContext reportContext;
    private HashMap<String,TestReport> reportMap;

    private MyReportContext(){
        reportMap = new HashMap<String,TestReport>();
    }

    public static MyReportContext getReportContext(){
        if(reportContext==null){
            reportContext = new MyReportContext();
        }
        return reportContext;
    }
    public synchronized void addMyReport(String username,TestReport testReport) {
        if (testReport != null) {
            reportMap.put(username, testReport);
        }
    }

    public synchronized void delMyReport(String username) {
        if (username == null) {
        }else {
            reportMap.remove(username);
        }


    }

    public synchronized TestReport getMyReport(String username) {
        if (username == null) {
            return null;
        }
        return reportMap.get(username);
    }

}
